/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
 * Description: 上机编程认证
 * Note: 缺省代码仅供参考，可自行决定使用、修改或删除
 */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <utility>
#include <unordered_map>
#include <algorithm>
using namespace std;

class Solution {
private:
    /*更新CharCount，只保留满足条件的字符并将其值重置为0*/
    void updateCharCount(unordered_map<char, int> &tmpCharCount, const int n) {
        auto it = tmpCharCount.begin();
        while (it != tmpCharCount.end()) {
            if (it->second >= n) {
                it->second = 0;
                ++it;
            } else {
                it = tmpCharCount.erase(it);
            }
        }
    }

public:
    vector<char> GetNTimesCharacter(int n, const vector<string> &strings) {
        //初始化字符计数
        unordered_map<char, int> tmpCharCount;
        for (char c: strings[0]) {
            tmpCharCount[c]++;
        }
        updateCharCount(tmpCharCount, n);
        //对后续进行返回更新
        for (int i = 1; i < strings.size(); ++i) {
            for (char c: strings[i]) {
                if (tmpCharCount.find(c) != tmpCharCount.end()) {
                    tmpCharCount[c]++;
                }
            }
            updateCharCount(tmpCharCount, n);
        }
        //将结果转换为vector
        vector<pair<char, int> > charCountVector(tmpCharCount.begin(), tmpCharCount.end());

        // 使用std::sort进行排序
        sort(charCountVector.begin(), charCountVector.end());

        vector<char> result(charCountVector.size());
        for (auto &pair: charCountVector) {
            result.push_back(pair.first);
        }
        return result;
    }
};

inline int ReadInt() {
    int number;
    cin >> number;
    return number;
}

template<typename T>
inline vector<T> ReadVector(int size) {
    vector<T> objects(size);
    for (int i = 0; i < size; ++i) {
        cin >> objects[i];
    }
    return objects;
}

template<typename T>
inline void WriteVector(const vector<T> &objects, char delimeter = ' ') {
    auto it = objects.begin();
    if (it == objects.end()) {
        return;
    }
    cout << *it;
    for (++it; it != objects.end(); ++it) {
        cout << delimeter << *it;
    }
}

int main() {
    int n = ReadInt();
    int m = ReadInt();
    vector<string> strings = ReadVector<string>(m);

    Solution solu;
    auto result = solu.GetNTimesCharacter(n, strings);
    cout << "[";
    WriteVector(result);
    cout << "]" << endl;
    return 0;
}
